const express = require('express');
const router = new express.Router();

/**
 * @param {Object} options
 * @param {} options.code 结算单号
 * @param {} options.dealerId 服务站Id
 * @param {} options.brandId 品牌Id
 * @param {} options.status 索赔结算单状态
 * @param {} options.tradeMethods 贸易方式
 * @param {} options.beginFinanceApproveTime 财务审核时间-开始时间
 * @param {} options.endFinanceApproveTime 财务审核时间-结束时间
 * @param {} options.pageSize 每页数据量
 * @param {} options.pageIndex 指定页
 * @param {} options.sortField 排序字段
 * @param {} options.isDesc 倒序排列
 * @throws {Error}
 * @return {Promise}
 */
router.get('/forCurrentUser', async(req, res, next) => {
    const options = {
        code: req.query.code,
        dealerId: req.query.dealerId,
        brandId: req.query.brandId,
        status: req.query.status,
        tradeMethods: req.query.tradeMethods,
        beginFinanceApproveTime: req.query.beginFinanceApproveTime,
        endFinanceApproveTime: req.query.endFinanceApproveTime,
        pageSize: req.query.pageSize,
        pageIndex: req.query.pageIndex,
        sortField: req.query.sortField,
        isDesc: req.query.isDesc
    };
    const data = {
        message: 'message',
        payload: {
            content: [
                {
                    id: 'id359',
                    code: 'code360',
                    dealerCode: 'dealerCode361',
                    brandCode: 'brandCode362',
                    materialFee: 1,
                    mgmtFee: 1,
                    laborFee: 1,
                    suppleMaterialFee: 1,
                    totalFee: 1,
                    outFee: 1,
                    status: 1,
                    currency: 1,
                    financeApproveTime: '2019-09-18T06:40:58Z',
                    rowVersion: 'rowVersion',
                    isApprove: false,
                    options: ['update', 'finance', 'submit', 'invoice', 'abandon', 'approve', 'reSettlement', 'confirmPI', 'moreApprove']
                },
                {
                    id: 'id363',
                    code: 'code364',
                    dealerCode: 'dealerCode365',
                    brandCode: 'brandCode366',
                    materialFee: 1,
                    mgmtFee: 1,
                    laborFee: 1,
                    suppleMaterialFee: 1,
                    totalFee: 1,
                    outFee: 1,
                    status: 1,
                    currency: 1,
                    financeApproveTime: '2019-09-18T06:40:58Z',
                    rowVersion: 'rowVersion',
                    isApprove: true,
                    options: ['update', 'finance', 'submit', 'invoice', 'abandon', 'approve', 'reSettlement', 'confirmPI', 'moreApprove']
                },
                {
                    id: 'id463',
                    code: 'code464',
                    dealerCode: 'dealerCode465',
                    brandCode: 'brandCode466',
                    materialFee: 1,
                    mgmtFee: 1,
                    laborFee: 1,
                    suppleMaterialFee: 1,
                    totalFee: 1,
                    outFee: 1,
                    status: 1,
                    currency: 1,
                    financeApproveTime: '2019-09-18T06:40:58Z',
                    rowVersion: 'rowVersion',
                    isApprove: true,
                    options: ['update', 'finance', 'submit', 'abandon', 'approve', 'reSettlement', 'confirmPI', 'moreApprove']
                }
            ],
            pageIndex: null,
            pageSize: null,
            sort: null,
            totalElements: 50,
            totalPages: null
        }
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @throws {Error}
 * @return {Promise}
 */
router.post('/', async(req, res, next) => {
    const options = {
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.id id
 * @throws {Error}
 * @return {Promise}
 */
router.get('/:id', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message',
        payload: {
            id: 'id367',
            code: 'code368',
            dealerCode: 'dealerCode369',
            businessType: 1,
            materialFee: 1,
            mgmtFee: 1,
            laborFee: 1,
            suppleMaterialFee: 1,
            totalFee: 1,
            outFee: 1,
            status: 1,
            currency: 1,
            remark: 'remark',
            rowVersion: 'rowVersion',
            department: 'department',
            options: ['update', 'finance', 'submit', 'invoice', 'abandon', 'approve', 'reSettlement', 'confirmPI', 'moreApprove'],
            financeApproverName: 'financeApproverName370',
            financeApproveTime: '2019-09-18T06:40:58Z',
            financeApproveOpinion: 'financeApproveOpinion',
            isApprove: true,
            reportComment: 'reportComment',
            details: [
                {
                    id: 'id371',
                    code: 'code372',
                    vin: 'vin',
                    causePartCode: 'causePartCode373',
                    causePartName: 'causePartName374',
                    materialFee: 1,
                    mgmtFee: 1,
                    laborFee: 1,
                    outFee: 1,
                    accessoryFee: 1,
                    totalFee: 1,
                    currency: 1,
                    productCategoryCode: 'productCategoryCode375'
                },
                {
                    id: 'id376',
                    code: 'code377',
                    vin: 'vin',
                    causePartCode: 'causePartCode378',
                    causePartName: 'causePartName379',
                    materialFee: 1,
                    mgmtFee: 1,
                    laborFee: 1,
                    outFee: 1,
                    accessoryFee: 1,
                    totalFee: 1,
                    currency: 1,
                    productCategoryCode: 'productCategoryCode380'
                }
            ],
            claimSettlementResultDetails: [
                {
                    id: '1',
                    approverName: 'approverName1',
                    approveTime: '2020-01-18T06:40:58Z',
                    result: 1
                },
                {
                    id: '2',
                    approverName: 'approverName2',
                    approveTime: '2020-02-18T06:40:58Z',
                    result: 2
                }
            ]
        }
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.id id
 * @throws {Error}
 * @return {Promise}
 */
router.put('/:id', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.id id
 * @throws {Error}
 * @return {Promise}
 */
router.put('/:id/submit', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @throws {Error}
 * @return {Promise}
 */
router.put('/invoice', async(req, res, next) => {
    const options = {
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.id id
 * @throws {Error}
 * @return {Promise}
 */
router.put('/:id/abandon', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.id id
 * @throws {Error}
 * @return {Promise}
 */
router.put('/:id/reSettlement', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.id id
 * @throws {Error}
 * @return {Promise}
 */
router.put('/:id/finance', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
// 确认PI
router.put('/:id/confirmPI', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.id id
 * @throws {Error}
 * @return {Promise}
 */
router.put('/:id/pass', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.id id
 * @throws {Error}
 * @return {Promise}
 */
router.put('/:id/reject', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.code 结算单号
 * @param {} options.dealerId 服务站Id
 * @param {} options.brandId 品牌Id
 * @param {} options.status 索赔结算单状态
 * @param {} options.tradeMethods 贸易方式
 * @param {} options.beginFinanceApproveTime 财务审核时间-开始时间
 * @param {} options.endFinanceApproveTime 财务审核时间-结束时间
 * @throws {Error}
 * @return {Promise}
 */
router.get('/export/forCurrentUser', async(req, res, next) => {
    const options = {
        code: req.query.code,
        dealerId: req.query.dealerId,
        brandId: req.query.brandId,
        status: req.query.status,
        tradeMethods: req.query.tradeMethods,
        beginFinanceApproveTime: req.query.beginFinanceApproveTime,
        endFinanceApproveTime: req.query.endFinanceApproveTime
    };
    const data = {
        message: 'message',
        payload: 'payload'
    };
    res.json(data);
});

/**
 * @param {Object} options
 * @param {} options.id id
 * @throws {Error}
 * @return {Promise}
 */
router.put('/:id/approve/pass', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.id id
 * @throws {Error}
 * @return {Promise}
 */
router.put('/:id/approve/reject', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
module.exports = router;
